package com.mallify.service.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mallify.common.model.system.SystemAdmin;
import com.mallify.service.mapper.SystemAdminMapper;
import com.mallify.service.service.SystemAdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * SystemAdminServiceImpl 接口实现
 * +----------------------------------------------------------------------
 * | HANSON [ HANSON赋能开发者，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Licensed HANSON并不是自由软件，未经许可不能去掉HANSON相关版权
 * +----------------------------------------------------------------------
 * | Author: HANSON Team <hanson0622@126.com>
 * +----------------------------------------------------------------------
 */
@Service
public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminMapper, SystemAdmin> implements SystemAdminService {

    @Resource
    private SystemAdminMapper systemAdminMapper;

    /**
     * 通过用户名获取用户
     * @param username 用户名
     * @return SystemAdmin
     */
    @Override
    public SystemAdmin selectUserByUserName(String username) {
        LambdaQueryWrapper<SystemAdmin> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SystemAdmin::getAccount, username);
        queryWrapper.eq(SystemAdmin::getIsDel, false);
        return systemAdminMapper.selectOne(queryWrapper);
    }
}